
<!DOCTYPE html>
<html lang="en">

<head>
    {include file='./head_template'/}
</head>

<body>

<div id="wrapper">
    {include file='./nav_template'/}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header"><?php echo $addTitle?>添加页面</h1>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        添加栏
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <form class="form-horizontal" action="doAction.php?act=addArticle" method="post">
                            <div class="form-group">
                                <label for="" class="col-sm-1 control-label">标题</label>
                                <div class="col-sm-11">
                                    <input type="text" class="form-control" id="" placeholder="标题" name="title">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-sm-1 control-label">标签</label>
                                <div class="col-sm-11">
                                    <div class="col-sm-4" style="padding: 0;">
                                        <select class="form-control" name="tag1">
                                            <?php foreach ($rowsColumn as $rowColumn):?>
                                                <option value="<?php echo $rowColumn['id']?>"><?php echo $rowColumn['name']?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                    <div class="col-sm-4" style="padding: 0;">
                                        <select class="form-control" name="tag2" id="myselect">
                                            <?php foreach ($rowsMenu as $rowMenu):?>
                                                <option value="<?php echo $rowMenu['id']?>" data-id="<?php echo $rowMenu['id']?>"><?php echo $rowMenu['name']?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                    <div class="col-sm-4" style="padding: 0;" id="linkage">
                                        <select class="form-control" name="tag3" id="myselectTwo" style="display: none;">
                                            <?php foreach ($rowsTag as $rowTag):?>
                                                <option value="<?php echo $rowTag['id']?>" data-tag-id="<?php echo $rowTag['menu_id']?>"><?php echo $rowTag['name']?></option>
                                            <?php endforeach;?>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-sm-1 control-label">时间</label>
                                <div class="col-sm-11">
                                    <input type="date" class="form-control" id="" name="time">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="" class="col-sm-1 control-label">审批人</label>
                                <div class="col-sm-11">
                                    <input type="text" class="form-control" id="" placeholder="审批人" name="reviewer">
                                </div>
                            </div>
                            <!-- 加载编辑器的容器 -->
                            <script id="container" name="content" type="text/plain">
                                这里写你的初始化内容
                            </script>
                            <div class="form-group" style="margin-top: 20px;">
                                <div class="col-sm-12">
                                    <button type="submit" class="btn btn-success btn-block">添加</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->

</div>
{include file='./foot_template'/}
<!-- 配置文件 -->
<script type="text/javascript" src="../riceText/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="../riceText/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container',{
        autoHeight: false,
        mergeEmptyline: true, //合并空行
        removeClass: true, //去掉冗余的class
        removeEmptyline: false, //去掉空行
        textAlign: "left", //段落的排版方式，可以是 left，right，center，justify 去掉这个属性表示不执行排版
        imageBlockLine: 'center', //图片的浮动方式，独占一行剧中，左右浮动，默认: center，left，right，none 去掉这个属性表示不执行排版
        pasteFilter: false, //根据规则过滤没事粘贴进来的内容
        clearFontSize: false, //去掉所有的内嵌字号，使用编辑器默认的字号
        clearFontFamily: false, //去掉所有的内嵌字体，使用编辑器默认的字体
        removeEmptyNode: false, // 去掉空节点
        //可以去掉的标签
        removeTagNames: {标签名字: 1
        },
        indent: false, // 行首缩进
        indentValue: '2em', //行首缩进的大小
        bdc2sb: false,
        tobdc: false,
        initialFrameHeight:300
    });
    //对编辑器的操作最好在编辑器ready之后再做
    ue.ready(function() {
        //设置编辑器的内容
        ue.setContent('hello');
        //获取html内容，返回: <p>hello</p>
        var html = ue.getContent();
        //获取纯文本内容，返回: hello
        var txt = ue.getContentTxt();
    });
</script>
<script>
    $("#myselect").change(function(){
        var dataId=$('#myselect option:selected').attr("data-id");
        console.log(dataId)
        $("#myselectTwo").children().attr("data-id",dataId);
        $("#myselectTwo").show();
        $("#myselectTwo").children().each(
            function(){
                if($(this).attr("data-id") == $(this).attr("data-tag-id")){
                    $(this).show();
                }else{
                    $(this).hide();
                }
            });
        })

</script>

</body>
</html>
